﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PeonyShop.Bussiness;
using System.Data;
using PenoyShop.Utilities;

namespace PeonyShop.Admin
{
    public partial class Product : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Admin"] != null)
            {
                if (!IsPostBack)
                {
                    BACategory bCate = new BACategory();
                    DataSet dsMain = bCate.GetAllCategoryByParenṭ(0, true, false);
                    ddlCate.DataTextField = "Name";
                    ddlCate.DataValueField = "CateId";
                    ddlCate.DataSource = dsMain.Tables[0];
                    ddlCate.DataBind();
                    ddlCate.Items.Insert(0, new ListItem("-- Please Choose --", "-1"));

                    /* For add */
                    ddlCategory.DataTextField = "Name";
                    ddlCategory.DataValueField = "CateId";
                    ddlCategory.DataSource = dsMain.Tables[0];
                    ddlCategory.DataBind();
                    ddlCategory.Items.Insert(0, new ListItem("-- Please Choose --", "-1"));

                }
            }
            else
                CodeHelper.Alert("Login trước rồi làm gì thì làm nhé", "Login.aspx");
        }
    }
}